package file;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.List;


public class Test {
	/**
     * 读取txt文件的内容
     * @param file 想要读取的文件对象
     * @return 返回文件内容
     */
    public static String txt2String(File file){
        StringBuilder result = new StringBuilder();
        try{
            BufferedReader br = new BufferedReader(new FileReader(file));//构造一个BufferedReader类来读取文件
            String s = null;
            while((s = br.readLine())!=null){//使用readLine方法，一次读一行
                result.append(System.lineSeparator()+s);
            }
            br.close();    
        }catch(Exception e){
            e.printStackTrace();
        }
        return result.toString();
    }
    public static void main(String[] args){
        File file = new File("c:\\TEMP\\qa_test\\yq.txt");
//        System.out.println(txt2String(file));
        
        String contactJson = txt2String(file);
        String[] s = contactJson.split("\r\n");
        System.out.println(s.length);
        
        System.out.println(contactJson.substring(contactJson.indexOf(s[0])+20, (contactJson.indexOf(s[100]))+20));
    }
    public static void main1(String[] args){
        File file = new File("d:\\ss.txt");
//        System.out.println(txt2String(file));
        
        String contactJson = txt2String(file);
        
//        System.out.println(contactJson);
        String dd = "account";
        File file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        File[] fs =  file1.listFiles(); 
        String s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
//			System.out.println(s+F);
//			System.out.println(f);
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "batch";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
//			System.out.println(s+F);
//			System.out.println(f);
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "credit";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "customer";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "job";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "market";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "order";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "pay";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "risk";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "sms";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = fs[i].getName().replace(".java", "").replace("SMSClear","clear").replace("SMSL","smsl").replace("SMSC","smsc").replace("SMS","sms");
			contactJson = contactJson.replace(f, s+F);
		}
        dd = "urge";
        file1 = new File("D:/work/workspace8/soros_v0.71/soros-job/soros-core-job/src/main/java/com/soros/job/schedule/"+dd);
        fs =  file1.listFiles(); 
        s = "com.soros.job.schedule."+dd+".";
        for (int i = 0; i < fs.length; i++) {
        	String F = fs[i].getName().replace(".java", "");
			String f = toLowerCaseFirstOne(fs[i].getName().replace(".java", ""));
			contactJson = contactJson.replace(f, s+F);
		}
        contactJson = contactJson.replace("logAlarmQuartzTask", "com.soros.job.schedule.LogAlarmQuartzTask");
        contactJson = contactJson.replace("searchSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSBatchSearchSMSUserQuartzTask");
        contactJson = contactJson.replace("initSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSInitSysUserQuartzTask");
        contactJson = contactJson.replace("clearSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSClearSMSUserQuartzTask");
        
        contactJson = contactJson.replace("clearA1SMSUserTask", "com.soros.job.schedule.sms.SMSClearA1UserQuartzTask");
        contactJson = contactJson.replace("clearA2SMSUserTask", "com.soros.job.schedule.sms.SMSClearA2UserQuartzTask");
        contactJson = contactJson.replace("clearA3SMSUserTask", "com.soros.job.schedule.sms.SMSClearA3UserQuartzTask");
        contactJson = contactJson.replace("clearA4SMSUserTask", "com.soros.job.schedule.sms.SMSClearA4UserQuartzTask");
        contactJson = contactJson.replace("clearA5SMSUserTask", "com.soros.job.schedule.sms.SMSClearA5UserQuartzTask");
        contactJson = contactJson.replace("clearA6SMSUserTask", "com.soros.job.schedule.sms.SMSClearA6UserQuartzTask");
        contactJson = contactJson.replace("importA1SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportA1UserQuartzTask");
        contactJson = contactJson.replace("importA2SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportA2UserQuartzTask");
        contactJson = contactJson.replace("importA3SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportA3UserQuartzTask");
        contactJson = contactJson.replace("importA4SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportA4UserQuartzTask");
        contactJson = contactJson.replace("importA5SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportA5UserQuartzTask");
        contactJson = contactJson.replace("importA6SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportA6UserQuartzTask");
        contactJson = contactJson.replace("importA6SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportA6UserQuartzTask");
        contactJson = contactJson.replace("clearRegister1T7SMSUserTask", "com.soros.job.schedule.sms.SMSClearB1UserQuartzTask");
        contactJson = contactJson.replace("clearRegister8T15SMSUserTask", "com.soros.job.schedule.sms.SMSClearB2UserQuartzTask");
        contactJson = contactJson.replace("clearRegister16T30SMSUserTask", "com.soros.job.schedule.sms.SMSClearB3UserQuartzTask");
        contactJson = contactJson.replace("clearRegister31T60SMSUserTask", "com.soros.job.schedule.sms.SMSClearC1UserQuartzTask");
        contactJson = contactJson.replace("clearRegister61T90SMSUserTask", "com.soros.job.schedule.sms.SMSClearC2UserQuartzTask");
        contactJson = contactJson.replace("importB1aSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB1AUserQuartzTask");
        contactJson = contactJson.replace("importB1bSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB1BUserQuartzTask");
        contactJson = contactJson.replace("importB2aSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB2AUserQuartzTask");
        contactJson = contactJson.replace("importB2bSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB2BUserQuartzTask");
        contactJson = contactJson.replace("importB3aSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB3AUserQuartzTask");
        contactJson = contactJson.replace("importB3bSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB3BUserQuartzTask");
        contactJson = contactJson.replace("importC1ASMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportC1AUserQuartzTask");
        contactJson = contactJson.replace("importC1bSMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportC1BUserQuartzTask");
        contactJson = contactJson.replace("importC2SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportC2UserQuartzTask");
        
        contactJson = contactJson.replace("clearSMSMemberQuartzTask", "com.soros.job.schedule.sms.SMSClearMemberQuartzTask");
        contactJson = contactJson.replace("clearASMSUserTask", "com.soros.job.schedule.sms.SMSClearAUserQuartzTask");
        contactJson = contactJson.replace("clearBCSMSUserTask", "com.soros.job.schedule.sms.SMSClearBCUserQuartzTask");
        
        contactJson = contactJson.replace("importB1SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB1UserQuartzTask");
        contactJson = contactJson.replace("importB2SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB2UserQuartzTask");
        contactJson = contactJson.replace("importB3SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportB3UserQuartzTask");
        contactJson = contactJson.replace("importC1SMSUserQuartzTask", "com.soros.job.schedule.sms.SMSImportC1UserQuartzTask");
        
        contactJson = contactJson.replace("clearRefuseUserOrderQuartzTask", "com.soros.job.schedule.sms.SMSRefuseUserClearQuartzTask");
        contactJson = contactJson.replace("refuseUserOrderQuartzTask", "com.soros.job.schedule.sms.SMSRefuseUserOrderQuartzTask");
        contactJson = contactJson.replace("importRefuseUserQuartzTask", "com.soros.job.schedule.sms.SMSImportRefuseUserQuartzTask");
        
//        contactJson = contactJson.replace("riskNewUserScoreQuartzTask", "com.soros.job.schedule.risk.RiskNewUserScoreQuartzTask");
//        contactJson = contactJson.replace("batchJPushQuartzTask", "com.soros.job.schedule.sms.BatchJPushQuartzTask");
        
        
        




        
        System.out.println(contactJson);
    }
    public static String toLowerCaseFirstOne(String s){
    	  if(Character.isLowerCase(s.charAt(0)))
    	    return s;
    	  else
    	    return (new StringBuilder()).append(Character.toLowerCase(s.charAt(0))).append(s.substring(1)).toString();
    	}
}
